﻿@model IEnumerable<ElCharro01.Models.Category>
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}
<div class="prefix_1 grid_8 suffix_1 alpha" align="center">
    <h2 align="center">
        Gestrione Categorie</h2>
    <p>
        @Html.ActionLink("Crea Nuova Categoria", "AddCategory")
    </p>
    <table>
        <tr>
            <th>
                Nome
            </th>
            <th>
                Prodotti Associati
            </th>
            <th colspan="2">
                Gestione Categoria
            </th>
        </tr>
        @foreach (var category in Model)
        {
            <tr>
                <td>
                    @category.Nome
                </td>
                <td align="center">
                    @category.Product.Count()
                </td>
                <td style="width: 50px;">
                    @Html.ActionLink("Edit", "EditCategory", new { id = category.Id })
                </td>
                <td style="width: 50px;">
                    @Html.ActionLink("Cancella", "Delete", "Category", new { id = category.Id }, new { })
                </td>
            </tr>
        }
    </table>
</div>
